package adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.dispatchapp.andlei.R;

import java.util.List;

import bean.WorkRiderBean;

/**
 * @author Andlei
 * @DATE 2019/1/21
 */
public class WorkingRiderAdapter extends BaseQuickAdapter<WorkRiderBean,BaseViewHolder> {

    public WorkingRiderAdapter(int layoutResId, @Nullable List<WorkRiderBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, WorkRiderBean item) {
        //is_coach 1校内，3校外,states状态 1工作，2下班
        if(item.getIs_coach().equals("1")){
            if(item.getStates().equals("1")){
                helper.setText(R.id.tv_name,item.getNickname()+"(送餐) "+"(接单中)");
            }else {
                helper.setText(R.id.tv_name,item.getNickname()+"(送餐) "+"(休息中)");
            }
        }else {
            if(item.getStates().equals("1")){
                helper.setText(R.id.tv_name,item.getNickname()+"(取餐) "+"(接单中)");
            }else {
                helper.setText(R.id.tv_name,item.getNickname()+"(取餐) "+"(休息中)");
            }
        }
       // helper.setText(R.id.tv_name,item.getNickname());
        helper.setText(R.id.tv_phone,item.getMobile());
        helper.addOnClickListener(R.id.img_phone);
        helper.addOnClickListener(R.id.tv_phone);
//        if(item.isSelect){
//            helper.getView(R.id.img_select).setVisibility(View.VISIBLE);
//        }else {
//            helper.getView(R.id.img_select).setVisibility(View.GONE);
//        }
    }
}
